Add algorithms - #243
Open
cat923 wants to merge 6 commits into
Open
Conversation
gsvgit
requested changes
Jul 29, 2026
| @@ -0,0 +1,16 @@ | |||
| # Install ruff to check your code style : | |||
| @@ -0,0 +1,21 @@ | |||
| from collections import deque | |||
|
|
|||
| INF = int(1e9) | |||
Member
There was a problem hiding this comment.
Why you need distance and infinite in BFS?
| depth += 1 | ||
| count += front_size | ||
| v.assign(front, depth, op_assign=INT.SECOND, op_select=INT.NQZERO) | ||
| front = front.vxm(v, A, op_mult=INT.LAND, op_add=INT.LOR, op_select=INT.EQZERO) |
Member
There was a problem hiding this comment.
How you prevent repeated visiting of vertices?
| return graph, n | ||
|
|
||
|
|
||
| def read_mtx_weighted(filename): |
Member
There was a problem hiding this comment.
Is it helper for MTX reading? Can we use standard functions to do it?
| from pyspla import FLOAT, INT, Matrix | ||
|
|
||
|
|
||
| def read_mtx_int(filename): |
Member
There was a problem hiding this comment.
Too many helpers with duplicated code. There are standard functions for mtx reading.
| read_vectors_weighted, | ||
| ) | ||
| from pr_classic import pagerank_classic | ||
| from sssp_classic import INF as SSSP_INF |
| from tc_spla import cohen | ||
|
|
||
|
|
||
| def main(): |
| import math | ||
|
|
||
|
|
||
| def pagerank_classic(adj_in, out_degree, n, alpha, eps): |
Member
There was a problem hiding this comment.
What is the reason to implement it again? can you use existing reference implementation?
| @@ -0,0 +1,14 @@ | |||
| INF = 1e9 | |||
| @@ -0,0 +1,41 @@ | |||
| from pyspla import FLOAT, Matrix, Scalar, Vector | |||
|
|
|||
| INF = float(1e9) | |||
Member
There was a problem hiding this comment.
infinity can be represented in floats.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implemented graph algorithms and test coverage for result comparison between Classic and SPLA versions.
Added project documentation with usage instructions and input format examples.
Added graph input readers for both vectors (.txt) and Matrix Market (.mtx) formats.